package com.xbongbong.saas.enums;

import lombok.Getter;

/**
 * 决策树联系人类型
 *
 * @Author: hongxiao
 * @date: 2021-12-20 11:54
 */
@Getter
public enum DecisionTreeContactTypeEnum {
    // 决策树节点中联系人类型
    PLACEHOLDER_CONTACT(0, "占位联系人", "placeholderContact"),
    NORMAL_CONTACT(1, "普通联系人", "normalContact"),
    DELETE_CONTACT(2, "删除联系人", "deleteContact")
    ;

    private Integer code;
    private String name;
    private String nameEn;

    DecisionTreeContactTypeEnum(Integer code, String name, String nameEn) {
        this.code = code;
        this.name = name;
        this.nameEn = nameEn;
    }

    public static DecisionTreeContactTypeEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (DecisionTreeContactTypeEnum cacheCode : values()) {
            if (code.equals(cacheCode.getCode())) {
                return cacheCode;
            }
        }
        return null;
    }

}
